package com.onstar.cn.framework.network;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by 6335yz on 2016/4/28.
 */
public class ThreadPoll {

    private ExecutorService fixedThreadPool;
    private ThreadPoll() {
        fixedThreadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
    }

    public static ThreadPoll getThreadPollInstance() {
        return SingeltonHolder.threadPoll;

    }

    private static class SingeltonHolder {
        private static final ThreadPoll threadPoll = new ThreadPoll();
    }

    public ExecutorService getExecutorService() {
        return fixedThreadPool;
    }
}
